<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text">
<div>div</div>
<span>span</span>
<img src="">
<div id="d2">div2</div>
<script>
    let d2 = document.querySelector("#d2");
    d2.innerText = "这是div2";
    //得到页面的div
    let d = document.querySelector("div");
    //修改div元素的文本内容
    d.innerText = "div内容被修改了";
    //得到页面的span
    let s = document.querySelector("span");
    s.innerText = "我也被修改了";
    //得到图片标签
    let img = document.querySelector("img");
    img.src = "../b.jpg";
    //得到文本框
    let input = document.querySelector("input");
    //修改文本框的值
    input.value = "ABC";
</script>
</body>
</html>